#include 
#include 
#include 
using namespace cv;
using namespace std;
void camera(){
    Mat image1;
    VideoCapture capl;
    
    capl.open(0);
    namedWindow("window1",1);
    
    while (1){
        capl >> image1;
        imshow("window1", image1);
        waitKey(100);
    }
    destroyWindow("window1");
}
void filevideo(){
    cvNamedWindow("Helloworld",CV_WINDOW_AUTOSIZE);
    CvCapture *capture = cvCreateFileCapture("/Users/yfsun/Desktop/test.264");
    IplImage *frame;
    while(1){
        frame = cvQueryFrame(capture);
        if (!frame)break;
        cvShowImage("Helloworld", frame);
        char c = cvWaitKey(100);
        if (c==27)break;
    }
    cvReleaseCapture(&capture);
    cvDestroyWindow("Helloworld");
}
int main(int argc, char** argv) {
    camera();
    filevideo();
    return 0;
}